home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 14 / hacker14.iso / programacao / visual / perl.exe / {app} / Templates / html / php.php < prev    next >
Encoding:
PHP Script  |  2003-01-11  |  1.3 KB  |  42 lines

  1. <html>
  2. <head>
  3. <title>PHP Script Example</title>
  4.  
  5. <!-- You can enclose PHP script either in 'script' HTML-tag... -->
  6.  
  7. <script LANGUAGE="php">
  8. pval entry;  entry.type = IS_LONG;entry.value.lval = 5;  
  9. /* defines $foo["bar"] = 5 */
  10. hash_update(arr.value.ht,"bar",sizeof("bar"),&entry,sizeof(pval),NULL); 
  11. /* defines $foo[7] = 5 */
  12. hash_index_update(arr.value.ht,7,&entry,sizeof(pval),NULL); 
  13. /* defines the next free place in $foo[], * $foo[8], to be 5 (works like php2)
  14.  */hash_next_index_insert(arr.value.ht,&entry,sizeof(pval),NULL);
  15.  
  16. pval *resource_id;RESOURCE *resource;int type;convert_to_long(resource_id);
  17. resource = php3_list_find(resource_id->value.lval, &type);
  18. if (type != LE_RESOURCE_TYPE) {
  19.     php3_error(E_WARNING,"resource index %d has the wrong type",resource_id->value.lval);
  20.     RETURN_FALSE;}/* ...use resource... */
  21. </script>
  22. </head>
  23.  
  24. <BODY bgColor=#ffffff leftMargin=40 link=#500000 vLink=#505050>
  25.  
  26. <!-- or in so-called short open/close tags. -->
  27.  
  28. <?php
  29.   if(!isset($PHP_AUTH_USER)) {
  30.     Header("WWW-Authenticate: Basic realm=\"My Realm\"");
  31.     Header("HTTP/1.0 401 Unauthorized");
  32.     echo "Text to send if user hits Cancel button\n";
  33.     exit;
  34.   }
  35.   else {
  36.     echo "Hello $PHP_AUTH_USER.<P>";
  37.     echo "You entered $PHP_AUTH_PW as your password.<P>";
  38.   }
  39. ?>
  40.  
  41. </body>
  42. </html>